Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

253
Vistas
Problem running Nodemon: "[nodemon] clean exit - waiting for changes before restart"

I am setting up a server and every time I try running npm start I get the following error:

[nodemon] 2.0.12
[nodemon] to restart at any time, enter 
`rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`      
[nodemon] clean exit - waiting for changes before restart

I have researched online such as StackOverflow, YouTube and even Reddit. However I do not understand why I am getting this error, since I added app.listen(). I have also ran npm updateto make sure that I have the most up to date npm version.

In addition, it seems that I need to revert to an older version of Nodemon, but I am wondering if there is a better way of doing this with more recent versions?

Here is what my code looks like:

index.js:

import express from "express";
import bodyParser from "body-parser";
import mongoose from "mongoose";
import cors from "cors";

const app = express();

app.use(express.json({ limit: "30mb", extended: true }));
app.use(express.urlencoded({ limit: "30mb", extended: true }));
app.use(cors());

// database connection string: PLEASE NOTE THAT I HAVE REPLACED MY PASSWORD WITH THE PROPER ONE HERE
const CONNECTION_URL =
  "mongodb+srv://admin2021:<password>@cluster0.haf0y.mongodb.net/myFirstDatabase?retryWrites=true&w=majority";
const PORT = process.env.PORT || 5000;

// connect to database
mongoose
  .connect(CONNECTION_URL, {
    useNewUrlParser: true,
    useUnifiedTopology: true,
  })
  .then(() =>
    app.listen(PORT, () => console.log(`Server running on port: ${PORT}`))
  )
  .catch(() => (error) => console.log(error.message));

package.json:

{
  "name": "server",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "start": "nodemon ./index.js"
  },
  // etc.
}

Please note that I tried replacing nodemon ./index.js with nodemon index.js but I obtain the same error.

Any help is appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

// connect to database
try {
  await mongoose.connect(url, options);
} catch (error) {
  console.log('connnection error', error)
}
app.listen(PORT, () => console.log(`Server running on port: ${PORT}`))

Try this

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda